package cn.edu.jxnu.sse.utils;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class DBUtil {
    public static DataSource ds = null;
    static{
        if(ds==null){
            ds = new ComboPooledDataSource();
        }
    }
    public static Connection getConnection(){
        Connection conn = null;
        try {
           conn = ds.getConnection();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return conn;
    }
}
